using System;
using System.Data;
using System.Data.Common;
using System.Data.SqlClient;

namespace SocialLearning.DataAccessLayer
{
	public static partial class DataAccessModule
    {
        #region Connection

        static DbConnection dbConnection;
        static DbProviderFactory dbProviderFactory = SqlClientFactory.Instance;

        static DataAccessModule()
        {
            SqlConnectionStringBuilder sb = new SqlConnectionStringBuilder();

            // 192.168.11.140  db-server-pc
            sb.DataSource = "192.168.11.140\\sociallearning";
            sb.InitialCatalog = "sldb";
            sb.IntegratedSecurity = true;

            dbConnection = new SqlConnection(sb.ToString());
            dbConnection.Open();
        }

        #endregion

		#region usp_add_t_assignment

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_assignment
		/// </summary>
		public class AddTAssignmentParams
		{
			public int SubjectId { get; set; }
			public int Total { get; set; }
			public DateTime IssueDate { get; set; }
			public DateTime DueDate { get; set; }
		}

		public static DbCommand CreateCommandForAddTAssignment(AddTAssignmentParams addTAssignmentParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = addTAssignmentParams.SubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TOTAL";
			parameter.Value = addTAssignmentParams.Total;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ISSUE_DATE";
			parameter.Value = addTAssignmentParams.IssueDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DUE_DATE";
			parameter.Value = addTAssignmentParams.DueDate;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_assignment

		#region usp_add_t_chat_group

		public static DbCommand CreateCommandForAddTChatGroup(string name, string avatar)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NAME";
			parameter.Value = name;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@AVATAR";
			parameter.Value = avatar;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_chat_group

		#region usp_add_t_content

		public static DbCommand CreateCommandForAddTContent(string title)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_content";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TITLE";
			parameter.Value = title;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_content

		#region usp_add_t_course

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_course
		/// </summary>
		public class AddTCourseParams
		{
			public DateTime StartDate { get; set; }
			public int CurrentYear { get; set; }
			public int OutstandingYears { get; set; }
			public int CompletedSubjects { get; set; }
			public int OutstandingSubjects { get; set; }
			public int FinancialState { get; set; }
			public int TotalCredits { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string DetailDescription { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string RequiredSubjects { get; set; }
		}

		public static DbCommand CreateCommandForAddTCourse(AddTCourseParams addTCourseParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_course";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@START_DATE";
			parameter.Value = addTCourseParams.StartDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CURRENT_YEAR";
			parameter.Value = addTCourseParams.CurrentYear;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OUTSTANDING_YEARS";
			parameter.Value = addTCourseParams.OutstandingYears;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COMPLETED_SUBJECTS";
			parameter.Value = addTCourseParams.CompletedSubjects;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OUTSTANDING_SUBJECTS";
			parameter.Value = addTCourseParams.OutstandingSubjects;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FINANCIAL_STATE";
			parameter.Value = addTCourseParams.FinancialState;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TOTAL_CREDITS";
			parameter.Value = addTCourseParams.TotalCredits;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DETAIL_DESCRIPTION";
			parameter.Value = addTCourseParams.DetailDescription;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@REQUIRED_SUBJECTS";
			parameter.Value = addTCourseParams.RequiredSubjects;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_course

		#region usp_add_t_eid

		public static DbCommand CreateCommandForAddTEid(string institutionName, DateTime startDate, DateTime endDate)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_eid";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INSTITUTION_NAME";
			parameter.Value = institutionName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@START_DATE";
			parameter.Value = startDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@END_DATE";
			parameter.Value = endDate;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_eid

		#region usp_add_t_feed

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_feed
		/// </summary>
		public class AddTFeedParams
		{
			public int FeedId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedIcon { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedTitle { get; set; }
			public DateTime FeedDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedContent { get; set; }
		}

		public static DbCommand CreateCommandForAddTFeed(AddTFeedParams addTFeedParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_feed";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_ID";
			parameter.Value = addTFeedParams.FeedId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Icon";
			parameter.Value = addTFeedParams.FeedIcon;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Title";
			parameter.Value = addTFeedParams.FeedTitle;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Date";
			parameter.Value = addTFeedParams.FeedDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@User_ID";
			parameter.Value = addTFeedParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Content";
			parameter.Value = addTFeedParams.FeedContent;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_feed

		#region usp_add_t_message

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_message
		/// </summary>
		public class AddTMessageParams
		{
			public int IsPublic { get; set; }
			public DateTime MessageTime { get; set; }
			public DateTime MessageDate { get; set; }
			public int UserGroupId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MessageContent { get; set; }
			public int GroupId { get; set; }
		}

		public static DbCommand CreateCommandForAddTMessage(AddTMessageParams addTMessageParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_message";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_Public";
			parameter.Value = addTMessageParams.IsPublic;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Time";
			parameter.Value = addTMessageParams.MessageTime;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Date";
			parameter.Value = addTMessageParams.MessageDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@User_Group_ID";
			parameter.Value = addTMessageParams.UserGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Content";
			parameter.Value = addTMessageParams.MessageContent;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Group_ID";
			parameter.Value = addTMessageParams.GroupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_message

		#region usp_add_t_previous_subjects

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_previous_subjects
		/// </summary>
		public class AddTPreviousSubjectsParams
		{
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectCode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string NqfLevel { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectResult { get; set; }
		}

		public static DbCommand CreateCommandForAddTPreviousSubjects(AddTPreviousSubjectsParams addTPreviousSubjectsParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_previous_subjects";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_NAME";
			parameter.Value = addTPreviousSubjectsParams.SubjectName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_CODE";
			parameter.Value = addTPreviousSubjectsParams.SubjectCode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NQF_LEVEL";
			parameter.Value = addTPreviousSubjectsParams.NqfLevel;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_RESULT";
			parameter.Value = addTPreviousSubjectsParams.SubjectResult;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_previous_subjects

		#region usp_add_t_resource

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_resource
		/// </summary>
		public class AddTResourceParams
		{
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ContentLink { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ResourceType { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Description { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Title { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Icon { get; set; }
		}

		public static DbCommand CreateCommandForAddTResource(AddTResourceParams addTResourceParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_resource";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CONTENT_LINK";
			parameter.Value = addTResourceParams.ContentLink;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@RESOURCE_TYPE";
			parameter.Value = addTResourceParams.ResourceType;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DESCRIPTION";
			parameter.Value = addTResourceParams.Description;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TITLE";
			parameter.Value = addTResourceParams.Title;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ICON";
			parameter.Value = addTResourceParams.Icon;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_resource

		#region usp_add_t_subject

		public static DbCommand CreateCommandForAddTSubject(string subjectName, string subjectIkon)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_NAME";
			parameter.Value = subjectName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_IKON";
			parameter.Value = subjectIkon;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_subject

		#region usp_add_t_subject_course

		public static DbCommand CreateCommandForAddTSubjectCourse(int subjectId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_subject_course";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = subjectId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_subject_course

		#region usp_add_t_user

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_user
		/// </summary>
		public class AddTUserParams
		{
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FirstName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string LastName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Gender { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Email { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HomeLanguage { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Nationality { get; set; }
			public DateTime DateOfBirth { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HomeAddress { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string PostalAddress { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string City { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Country { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string PostalCode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MedicalAid { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MedicalNumber { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string EthnicGroup { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Disabilities { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string AccountId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Password { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Question { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Passcode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Status { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MarketingMedium { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MarketingComment { get; set; }
			public DateTime MarketingDateOfSubmission { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string OccupationStatus { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HighSchoolDetails { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Avatar { get; set; }
			public int IsOnline { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ProfileStatus { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string CellPhone { get; set; }
			public bool IsActive { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FamilyType { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FamilyId { get; set; }
		}

		public static DbCommand CreateCommandForAddTUser(AddTUserParams addTUserParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_user";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = addTUserParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FIRST_NAME";
			parameter.Value = addTUserParams.FirstName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@LAST_NAME";
			parameter.Value = addTUserParams.LastName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GENDER";
			parameter.Value = addTUserParams.Gender;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@EMAIL";
			parameter.Value = addTUserParams.Email;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HOME_LANGUAGE";
			parameter.Value = addTUserParams.HomeLanguage;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NATIONALITY";
			parameter.Value = addTUserParams.Nationality;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DATE_OF_BIRTH";
			parameter.Value = addTUserParams.DateOfBirth;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HOME_ADDRESS";
			parameter.Value = addTUserParams.HomeAddress;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@POSTAL_ADDRESS";
			parameter.Value = addTUserParams.PostalAddress;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CITY";
			parameter.Value = addTUserParams.City;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COUNTRY";
			parameter.Value = addTUserParams.Country;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@POSTAL_CODE";
			parameter.Value = addTUserParams.PostalCode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MEDICAL_AID";
			parameter.Value = addTUserParams.MedicalAid;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MEDICAL_NUMBER";
			parameter.Value = addTUserParams.MedicalNumber;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ETHNIC_GROUP";
			parameter.Value = addTUserParams.EthnicGroup;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DISABILITIES";
			parameter.Value = addTUserParams.Disabilities;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ACCOUNT_ID";
			parameter.Value = addTUserParams.AccountId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PASSWORD";
			parameter.Value = addTUserParams.Password;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@QUESTION";
			parameter.Value = addTUserParams.Question;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PASSCODE";
			parameter.Value = addTUserParams.Passcode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@STATUS";
			parameter.Value = addTUserParams.Status;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_MEDIUM";
			parameter.Value = addTUserParams.MarketingMedium;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_COMMENT";
			parameter.Value = addTUserParams.MarketingComment;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_DATE_OF_SUBMISSION";
			parameter.Value = addTUserParams.MarketingDateOfSubmission;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OCCUPATION_STATUS";
			parameter.Value = addTUserParams.OccupationStatus;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HIGH_SCHOOL_DETAILS";
			parameter.Value = addTUserParams.HighSchoolDetails;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@AVATAR";
			parameter.Value = addTUserParams.Avatar;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_ONLINE";
			parameter.Value = addTUserParams.IsOnline;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PROFILE_STATUS";
			parameter.Value = addTUserParams.ProfileStatus;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CELL_PHONE";
			parameter.Value = addTUserParams.CellPhone;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Boolean;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_ACTIVE";
			parameter.Value = addTUserParams.IsActive;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FAMILY_TYPE";
			parameter.Value = addTUserParams.FamilyType;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FAMILY_ID";
			parameter.Value = addTUserParams.FamilyId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_user

		#region usp_add_t_user_assignment

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_add_t_user_assignment
		/// </summary>
		public class AddTUserAssignmentParams
		{
			public int AssignmentId { get; set; }
			public int Mark { get; set; }
			public DateTime SubmitDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string DownloadFile { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UploadFile { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
		}

		public static DbCommand CreateCommandForAddTUserAssignment(AddTUserAssignmentParams addTUserAssignmentParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_user_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ASSIGNMENT_ID";
			parameter.Value = addTUserAssignmentParams.AssignmentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARK";
			parameter.Value = addTUserAssignmentParams.Mark;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBMIT_DATE";
			parameter.Value = addTUserAssignmentParams.SubmitDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DOWNLOAD_FILE";
			parameter.Value = addTUserAssignmentParams.DownloadFile;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@UPLOAD_FILE";
			parameter.Value = addTUserAssignmentParams.UploadFile;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = addTUserAssignmentParams.UserId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_user_assignment

		#region usp_add_t_user_chat_group

		public static DbCommand CreateCommandForAddTUserChatGroup(string userId, int chatGroupId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_user_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CHAT_GROUP_ID";
			parameter.Value = chatGroupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_user_chat_group

		#region usp_add_t_user_group

		public static DbCommand CreateCommandForAddTUserGroup(string userId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_user_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_user_group

		#region usp_add_t_user_subject

		public static DbCommand CreateCommandForAddTUserSubject(bool isComplete, decimal subjectMark, string userId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_add_t_user_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Boolean;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_COMPLETE";
			parameter.Value = isComplete;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Decimal;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_MARK";
			parameter.Value = subjectMark;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_add_t_user_subject

		#region usp_delete_t_assignment

		public static DbCommand CreateCommandForDeleteTAssignment(int assignmentId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ASSIGNMENT_ID";
			parameter.Value = assignmentId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_assignment

		#region usp_delete_t_chat_group

		public static DbCommand CreateCommandForDeleteTChatGroup(int groupId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GROUP_ID";
			parameter.Value = groupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_chat_group

		#region usp_delete_t_content

		public static DbCommand CreateCommandForDeleteTContent(int contentId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_content";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CONTENT_ID";
			parameter.Value = contentId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_content

		#region usp_delete_t_subject

		public static DbCommand CreateCommandForDeleteTSubject(int subjectId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = subjectId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_subject

		#region usp_delete_t_user

		public static DbCommand CreateCommandForDeleteTUser(string userId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_user";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 1;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_user

		#region usp_delete_t_user_assignment

		public static DbCommand CreateCommandForDeleteTUserAssignment(int userAssignmentId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_user_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ASSIGNMENT_ID";
			parameter.Value = userAssignmentId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_user_assignment

		#region usp_delete_t_user_chat_group

		public static DbCommand CreateCommandForDeleteTUserChatGroup(int userChatGroupId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_delete_t_user_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_CHAT_GROUP_ID";
			parameter.Value = userChatGroupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_delete_t_user_chat_group

		#region usp_get_t_assignment

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_assignment
		/// </summary>
		public class TAssignmentParams
		{
			public int AssignmentId { get; set; }
			public int SubjectId { get; set; }
			public int Total { get; set; }
			public DateTime IssueDate { get; set; }
			public DateTime DueDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Description { get; set; }
		}

		public static DbDataReader GetTAssignment(TAssignmentParams tAssignmentParams)
		{
			using (var command = CreateCommandForGetTAssignment(tAssignmentParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTAssignmentDataTable(TAssignmentParams tAssignmentParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTAssignment(tAssignmentParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTAssignment(TAssignmentParams tAssignmentParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ASSIGNMENT_ID";
			parameter.Value = tAssignmentParams.AssignmentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = tAssignmentParams.SubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TOTAL";
			parameter.Value = tAssignmentParams.Total;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ISSUE_DATE";
			parameter.Value = tAssignmentParams.IssueDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DUE_DATE";
			parameter.Value = tAssignmentParams.DueDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DESCRIPTION";
			parameter.Value = tAssignmentParams.Description;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_assignment

		#region usp_get_t_chat_group

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_chat_group
		/// </summary>
		public class TChatGroupParams
		{
			public int GroupId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Name { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Avatar { get; set; }
			public int JoinedUsers { get; set; }
		}

		public static DbDataReader GetTChatGroup(TChatGroupParams tChatGroupParams)
		{
			using (var command = CreateCommandForGetTChatGroup(tChatGroupParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTChatGroupDataTable(TChatGroupParams tChatGroupParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTChatGroup(tChatGroupParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTChatGroup(TChatGroupParams tChatGroupParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GROUP_ID";
			parameter.Value = tChatGroupParams.GroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NAME";
			parameter.Value = tChatGroupParams.Name;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@AVATAR";
			parameter.Value = tChatGroupParams.Avatar;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@JOINED_USERS";
			parameter.Value = tChatGroupParams.JoinedUsers;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_chat_group

		#region usp_get_t_content

		public static DbDataReader GetTContent(int contentId, string title, string infoContent)
		{
			using (var command = CreateCommandForGetTContent(contentId, title, infoContent))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTContentDataTable(int contentId, string title, string infoContent)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTContent(contentId, title, infoContent);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTContent(int contentId, string title, string infoContent)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_content";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CONTENT_ID";
			parameter.Value = contentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TITLE";
			parameter.Value = title;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INFO_CONTENT";
			parameter.Value = infoContent;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_content

		#region usp_get_t_course

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_course
		/// </summary>
		public class TCourseParams
		{
			public int CourseId { get; set; }
			public DateTime StartDate { get; set; }
			public int CurrentYear { get; set; }
			public int OutstandingYears { get; set; }
			public int CompletedSubjects { get; set; }
			public int OutstandingSubjects { get; set; }
			public int FinancialState { get; set; }
			public int TotalCredits { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string DetailDescription { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string RequiredSubjects { get; set; }
		}

		public static DbDataReader GetTCourse(TCourseParams tCourseParams)
		{
			using (var command = CreateCommandForGetTCourse(tCourseParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTCourseDataTable(TCourseParams tCourseParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTCourse(tCourseParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTCourse(TCourseParams tCourseParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_course";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COURSE_ID";
			parameter.Value = tCourseParams.CourseId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@START_DATE";
			parameter.Value = tCourseParams.StartDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CURRENT_YEAR";
			parameter.Value = tCourseParams.CurrentYear;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OUTSTANDING_YEARS";
			parameter.Value = tCourseParams.OutstandingYears;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COMPLETED_SUBJECTS";
			parameter.Value = tCourseParams.CompletedSubjects;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OUTSTANDING_SUBJECTS";
			parameter.Value = tCourseParams.OutstandingSubjects;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FINANCIAL_STATE";
			parameter.Value = tCourseParams.FinancialState;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TOTAL_CREDITS";
			parameter.Value = tCourseParams.TotalCredits;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DETAIL_DESCRIPTION";
			parameter.Value = tCourseParams.DetailDescription;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@REQUIRED_SUBJECTS";
			parameter.Value = tCourseParams.RequiredSubjects;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_course

		#region usp_get_t_eid

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_eid
		/// </summary>
		public class TEidParams
		{
			public int InstitutionId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string InstitutionName { get; set; }
			public DateTime StartDate { get; set; }
			public DateTime EndDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
		}

		public static DbDataReader GetTEid(TEidParams tEidParams)
		{
			using (var command = CreateCommandForGetTEid(tEidParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTEidDataTable(TEidParams tEidParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTEid(tEidParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTEid(TEidParams tEidParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_eid";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INSTITUTION_ID";
			parameter.Value = tEidParams.InstitutionId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INSTITUTION_NAME";
			parameter.Value = tEidParams.InstitutionName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@START_DATE";
			parameter.Value = tEidParams.StartDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@END_DATE";
			parameter.Value = tEidParams.EndDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = tEidParams.UserId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_eid

		#region usp_get_t_feed

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_feed
		/// </summary>
		public class TFeedParams
		{
			public int FeedId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedIcon { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedTitle { get; set; }
			public DateTime FeedDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedContent { get; set; }
		}

		public static DbDataReader GetTFeed(TFeedParams tFeedParams)
		{
			using (var command = CreateCommandForGetTFeed(tFeedParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTFeedDataTable(TFeedParams tFeedParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTFeed(tFeedParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTFeed(TFeedParams tFeedParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_feed";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_ID";
			parameter.Value = tFeedParams.FeedId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Icon";
			parameter.Value = tFeedParams.FeedIcon;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Title";
			parameter.Value = tFeedParams.FeedTitle;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Date";
			parameter.Value = tFeedParams.FeedDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@User_ID";
			parameter.Value = tFeedParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Content";
			parameter.Value = tFeedParams.FeedContent;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_feed

		#region usp_get_t_group

		public static DbDataReader GetTGroup(int groupId, string groupName)
		{
			using (var command = CreateCommandForGetTGroup(groupId, groupName))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTGroupDataTable(int groupId, string groupName)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTGroup(groupId, groupName);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTGroup(int groupId, string groupName)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Group_ID";
			parameter.Value = groupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Group_Name";
			parameter.Value = groupName;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_group

		#region usp_get_t_message

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_message
		/// </summary>
		public class TMessageParams
		{
			public int MessageId { get; set; }
			public int IsPublic { get; set; }
			public DateTime MessageTime { get; set; }
			public DateTime MessageDate { get; set; }
			public int UserGroupId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MessageContent { get; set; }
			public int GroupId { get; set; }
		}

		public static DbDataReader GetTMessage(TMessageParams tMessageParams)
		{
			using (var command = CreateCommandForGetTMessage(tMessageParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTMessageDataTable(TMessageParams tMessageParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTMessage(tMessageParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTMessage(TMessageParams tMessageParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_message";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_ID";
			parameter.Value = tMessageParams.MessageId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_Public";
			parameter.Value = tMessageParams.IsPublic;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Time";
			parameter.Value = tMessageParams.MessageTime;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Date";
			parameter.Value = tMessageParams.MessageDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@User_Group_ID";
			parameter.Value = tMessageParams.UserGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Content";
			parameter.Value = tMessageParams.MessageContent;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Group_ID";
			parameter.Value = tMessageParams.GroupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_message

		#region usp_get_t_previous_subjects

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_previous_subjects
		/// </summary>
		public class TPreviousSubjectsParams
		{
			public int SubjectId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectCode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string NqfLevel { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectResult { get; set; }
			public int InstitutionId { get; set; }
		}

		public static DbDataReader GetTPreviousSubjects(TPreviousSubjectsParams tPreviousSubjectsParams)
		{
			using (var command = CreateCommandForGetTPreviousSubjects(tPreviousSubjectsParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTPreviousSubjectsDataTable(TPreviousSubjectsParams tPreviousSubjectsParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTPreviousSubjects(tPreviousSubjectsParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTPreviousSubjects(TPreviousSubjectsParams tPreviousSubjectsParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_previous_subjects";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = tPreviousSubjectsParams.SubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_NAME";
			parameter.Value = tPreviousSubjectsParams.SubjectName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_CODE";
			parameter.Value = tPreviousSubjectsParams.SubjectCode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NQF_LEVEL";
			parameter.Value = tPreviousSubjectsParams.NqfLevel;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_RESULT";
			parameter.Value = tPreviousSubjectsParams.SubjectResult;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INSTITUTION_ID";
			parameter.Value = tPreviousSubjectsParams.InstitutionId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_previous_subjects

		#region usp_get_t_resource

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_resource
		/// </summary>
		public class TResourceParams
		{
			public int ResourceId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ContentLink { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ResourceType { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Description { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Title { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Icon { get; set; }
			public int SubjectId { get; set; }
		}

		public static DbDataReader GetTResource(TResourceParams tResourceParams)
		{
			using (var command = CreateCommandForGetTResource(tResourceParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTResourceDataTable(TResourceParams tResourceParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTResource(tResourceParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTResource(TResourceParams tResourceParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_resource";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@RESOURCE_ID";
			parameter.Value = tResourceParams.ResourceId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CONTENT_LINK";
			parameter.Value = tResourceParams.ContentLink;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@RESOURCE_TYPE";
			parameter.Value = tResourceParams.ResourceType;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DESCRIPTION";
			parameter.Value = tResourceParams.Description;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TITLE";
			parameter.Value = tResourceParams.Title;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ICON";
			parameter.Value = tResourceParams.Icon;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = tResourceParams.SubjectId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_resource

		#region usp_get_t_subject

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_subject
		/// </summary>
		public class TSubjectParams
		{
			public int SubjectId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectIkon { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectDescription { get; set; }
		}

		public static DbDataReader GetTSubject(TSubjectParams tSubjectParams)
		{
			using (var command = CreateCommandForGetTSubject(tSubjectParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTSubjectDataTable(TSubjectParams tSubjectParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTSubject(tSubjectParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTSubject(TSubjectParams tSubjectParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = tSubjectParams.SubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_NAME";
			parameter.Value = tSubjectParams.SubjectName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_IKON";
			parameter.Value = tSubjectParams.SubjectIkon;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_DESCRIPTION";
			parameter.Value = tSubjectParams.SubjectDescription;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_subject

		#region usp_get_t_subject_course

		public static DbDataReader GetTSubjectCourse(int subjectCourseId, int subjectId, int courseId)
		{
			using (var command = CreateCommandForGetTSubjectCourse(subjectCourseId, subjectId, courseId))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTSubjectCourseDataTable(int subjectCourseId, int subjectId, int courseId)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTSubjectCourse(subjectCourseId, subjectId, courseId);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTSubjectCourse(int subjectCourseId, int subjectId, int courseId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_subject_course";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_COURSE_ID";
			parameter.Value = subjectCourseId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = subjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COURSE_ID";
			parameter.Value = courseId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_subject_course

		#region usp_get_t_user

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_user
		/// </summary>
		public class TUserParams
		{
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FirstName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string LastName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Gender { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Email { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HomeLanguage { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Nationality { get; set; }
			public DateTime DateOfBirth { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HomeAddress { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string PostalAddress { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string City { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Country { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string PostalCode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MedicalAid { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MedicalNumber { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string EthnicGroup { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Disabilities { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string AccountId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Password { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Question { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Passcode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Status { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MarketingMedium { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MarketingComment { get; set; }
			public DateTime MarketingDateOfSubmission { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string OccupationStatus { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HighSchoolDetails { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Avatar { get; set; }
			public int IsOnline { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ProfileStatus { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string CellPhone { get; set; }
			public bool IsActive { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FamilyType { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FamilyId { get; set; }
		}

		public static DbDataReader GetTUser(TUserParams tUserParams)
		{
			using (var command = CreateCommandForGetTUser(tUserParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTUserDataTable(TUserParams tUserParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTUser(tUserParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTUser(TUserParams tUserParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_user";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = tUserParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FIRST_NAME";
			parameter.Value = tUserParams.FirstName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@LAST_NAME";
			parameter.Value = tUserParams.LastName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GENDER";
			parameter.Value = tUserParams.Gender;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@EMAIL";
			parameter.Value = tUserParams.Email;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HOME_LANGUAGE";
			parameter.Value = tUserParams.HomeLanguage;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NATIONALITY";
			parameter.Value = tUserParams.Nationality;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DATE_OF_BIRTH";
			parameter.Value = tUserParams.DateOfBirth;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HOME_ADDRESS";
			parameter.Value = tUserParams.HomeAddress;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@POSTAL_ADDRESS";
			parameter.Value = tUserParams.PostalAddress;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CITY";
			parameter.Value = tUserParams.City;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COUNTRY";
			parameter.Value = tUserParams.Country;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@POSTAL_CODE";
			parameter.Value = tUserParams.PostalCode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MEDICAL_AID";
			parameter.Value = tUserParams.MedicalAid;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MEDICAL_NUMBER";
			parameter.Value = tUserParams.MedicalNumber;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ETHNIC_GROUP";
			parameter.Value = tUserParams.EthnicGroup;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DISABILITIES";
			parameter.Value = tUserParams.Disabilities;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ACCOUNT_ID";
			parameter.Value = tUserParams.AccountId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PASSWORD";
			parameter.Value = tUserParams.Password;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@QUESTION";
			parameter.Value = tUserParams.Question;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PASSCODE";
			parameter.Value = tUserParams.Passcode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@STATUS";
			parameter.Value = tUserParams.Status;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_MEDIUM";
			parameter.Value = tUserParams.MarketingMedium;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_COMMENT";
			parameter.Value = tUserParams.MarketingComment;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_DATE_OF_SUBMISSION";
			parameter.Value = tUserParams.MarketingDateOfSubmission;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OCCUPATION_STATUS";
			parameter.Value = tUserParams.OccupationStatus;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HIGH_SCHOOL_DETAILS";
			parameter.Value = tUserParams.HighSchoolDetails;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@AVATAR";
			parameter.Value = tUserParams.Avatar;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_ONLINE";
			parameter.Value = tUserParams.IsOnline;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PROFILE_STATUS";
			parameter.Value = tUserParams.ProfileStatus;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CELL_PHONE";
			parameter.Value = tUserParams.CellPhone;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Boolean;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_ACTIVE";
			parameter.Value = tUserParams.IsActive;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FAMILY_TYPE";
			parameter.Value = tUserParams.FamilyType;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FAMILY_ID";
			parameter.Value = tUserParams.FamilyId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_user

		#region usp_get_t_user_assignment

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_user_assignment
		/// </summary>
		public class TUserAssignmentParams
		{
			public int UserAssignmentId { get; set; }
			public int Mark { get; set; }
			public DateTime SubmitDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string DownloadFile { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UploadFile { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			public int AssignmentId { get; set; }
		}

		public static DbDataReader GetTUserAssignment(TUserAssignmentParams tUserAssignmentParams)
		{
			using (var command = CreateCommandForGetTUserAssignment(tUserAssignmentParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTUserAssignmentDataTable(TUserAssignmentParams tUserAssignmentParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTUserAssignment(tUserAssignmentParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTUserAssignment(TUserAssignmentParams tUserAssignmentParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_user_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ASSIGNMENT_ID";
			parameter.Value = tUserAssignmentParams.UserAssignmentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARK";
			parameter.Value = tUserAssignmentParams.Mark;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBMIT_DATE";
			parameter.Value = tUserAssignmentParams.SubmitDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DOWNLOAD_FILE";
			parameter.Value = tUserAssignmentParams.DownloadFile;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@UPLOAD_FILE";
			parameter.Value = tUserAssignmentParams.UploadFile;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = tUserAssignmentParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ASSIGNMENT_ID";
			parameter.Value = tUserAssignmentParams.AssignmentId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_user_assignment

		#region usp_get_t_user_chat_group

		public static DbDataReader GetTUserChatGroup(int userChatGroupId, string userId, int chatGroupId)
		{
			using (var command = CreateCommandForGetTUserChatGroup(userChatGroupId, userId, chatGroupId))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTUserChatGroupDataTable(int userChatGroupId, string userId, int chatGroupId)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTUserChatGroup(userChatGroupId, userId, chatGroupId);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTUserChatGroup(int userChatGroupId, string userId, int chatGroupId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_user_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_CHAT_GROUP_ID";
			parameter.Value = userChatGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CHAT_GROUP_ID";
			parameter.Value = chatGroupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_user_chat_group

		#region usp_get_t_user_group

		public static DbDataReader GetTUserGroup(int userGroupId, string userId, int groupId)
		{
			using (var command = CreateCommandForGetTUserGroup(userGroupId, userId, groupId))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTUserGroupDataTable(int userGroupId, string userId, int groupId)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTUserGroup(userGroupId, userId, groupId);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTUserGroup(int userGroupId, string userId, int groupId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_user_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_GROUP_ID";
			parameter.Value = userGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GROUP_ID";
			parameter.Value = groupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_user_group

		#region usp_get_t_user_subject

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_get_t_user_subject
		/// </summary>
		public class TUserSubjectParams
		{
			public int UserSubjectId { get; set; }
			public bool IsComplete { get; set; }
			public decimal SubjectMark { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			public int SubjectId { get; set; }
		}

		public static DbDataReader GetTUserSubject(TUserSubjectParams tUserSubjectParams)
		{
			using (var command = CreateCommandForGetTUserSubject(tUserSubjectParams))
			{
				dbConnection.Open();
				return command.ExecuteReader(CommandBehavior.CloseConnection);
			}
		}

		public static DataTable GetTUserSubjectDataTable(TUserSubjectParams tUserSubjectParams)
		{
			var adapter = dbProviderFactory.CreateDataAdapter();
			adapter.SelectCommand = CreateCommandForGetTUserSubject(tUserSubjectParams);
			var dt = new DataTable();
			adapter.Fill(dt);
			return dt;
		}

		public static DbCommand CreateCommandForGetTUserSubject(TUserSubjectParams tUserSubjectParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_get_t_user_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_SUBJECT_ID";
			parameter.Value = tUserSubjectParams.UserSubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Boolean;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_COMPLETE";
			parameter.Value = tUserSubjectParams.IsComplete;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Decimal;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_MARK";
			parameter.Value = tUserSubjectParams.SubjectMark;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = tUserSubjectParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = tUserSubjectParams.SubjectId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_get_t_user_subject

		#region usp_update_t_assignment

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_assignment
		/// </summary>
		public class UpdateTAssignmentParams
		{
			public int AssignmentId { get; set; }
			public int SubjectId { get; set; }
			public int Total { get; set; }
			public DateTime IssueDate { get; set; }
			public DateTime DueDate { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTAssignment(UpdateTAssignmentParams updateTAssignmentParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ASSIGNMENT_ID";
			parameter.Value = updateTAssignmentParams.AssignmentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = updateTAssignmentParams.SubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TOTAL";
			parameter.Value = updateTAssignmentParams.Total;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ISSUE_DATE";
			parameter.Value = updateTAssignmentParams.IssueDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DUE_DATE";
			parameter.Value = updateTAssignmentParams.DueDate;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_assignment

		#region usp_update_t_chat_group

		public static DbCommand CreateCommandForUpdateTChatGroup(int groupId, string name, string avatar)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GROUP_ID";
			parameter.Value = groupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NAME";
			parameter.Value = name;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@AVATAR";
			parameter.Value = avatar;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_chat_group

		#region usp_update_t_content

		public static DbCommand CreateCommandForUpdateTContent(int contentId, string title)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_content";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CONTENT_ID";
			parameter.Value = contentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TITLE";
			parameter.Value = title;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_content

		#region usp_update_t_course

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_course
		/// </summary>
		public class UpdateTCourseParams
		{
			public int CourseId { get; set; }
			public DateTime StartDate { get; set; }
			public int CurrentYear { get; set; }
			public int OutstandingYears { get; set; }
			public int CompletedSubjects { get; set; }
			public int OutstandingSubjects { get; set; }
			public int FinancialState { get; set; }
			public int TotalCredits { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string DetailDescription { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTCourse(UpdateTCourseParams updateTCourseParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_course";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COURSE_ID";
			parameter.Value = updateTCourseParams.CourseId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@START_DATE";
			parameter.Value = updateTCourseParams.StartDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CURRENT_YEAR";
			parameter.Value = updateTCourseParams.CurrentYear;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OUTSTANDING_YEARS";
			parameter.Value = updateTCourseParams.OutstandingYears;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COMPLETED_SUBJECTS";
			parameter.Value = updateTCourseParams.CompletedSubjects;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OUTSTANDING_SUBJECTS";
			parameter.Value = updateTCourseParams.OutstandingSubjects;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FINANCIAL_STATE";
			parameter.Value = updateTCourseParams.FinancialState;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TOTAL_CREDITS";
			parameter.Value = updateTCourseParams.TotalCredits;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DETAIL_DESCRIPTION";
			parameter.Value = updateTCourseParams.DetailDescription;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_course

		#region usp_update_t_eid

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_eid
		/// </summary>
		public class UpdateTEidParams
		{
			public int InstitutionId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string InstitutionName { get; set; }
			public DateTime StartDate { get; set; }
			public DateTime EndDate { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTEid(UpdateTEidParams updateTEidParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_eid";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INSTITUTION_ID";
			parameter.Value = updateTEidParams.InstitutionId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@INSTITUTION_NAME";
			parameter.Value = updateTEidParams.InstitutionName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@START_DATE";
			parameter.Value = updateTEidParams.StartDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@END_DATE";
			parameter.Value = updateTEidParams.EndDate;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_eid

		#region usp_update_t_feed

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_feed
		/// </summary>
		public class UpdateTFeedParams
		{
			public int FeedId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedIcon { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedTitle { get; set; }
			public DateTime FeedDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FeedContent { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTFeed(UpdateTFeedParams updateTFeedParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_feed";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_ID";
			parameter.Value = updateTFeedParams.FeedId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Icon";
			parameter.Value = updateTFeedParams.FeedIcon;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Title";
			parameter.Value = updateTFeedParams.FeedTitle;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Date";
			parameter.Value = updateTFeedParams.FeedDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@User_ID";
			parameter.Value = updateTFeedParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Feed_Content";
			parameter.Value = updateTFeedParams.FeedContent;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_feed

		#region usp_update_t_message

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_message
		/// </summary>
		public class UpdateTMessageParams
		{
			public int MessageId { get; set; }
			public int IsPublic { get; set; }
			public DateTime MessageTime { get; set; }
			public DateTime MessageDate { get; set; }
			public int UserGroupId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MessageContent { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTMessage(UpdateTMessageParams updateTMessageParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_message";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_ID";
			parameter.Value = updateTMessageParams.MessageId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_Public";
			parameter.Value = updateTMessageParams.IsPublic;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Time";
			parameter.Value = updateTMessageParams.MessageTime;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Date";
			parameter.Value = updateTMessageParams.MessageDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@User_Group_ID";
			parameter.Value = updateTMessageParams.UserGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@Message_Content";
			parameter.Value = updateTMessageParams.MessageContent;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_message

		#region usp_update_t_previous_subjects

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_previous_subjects
		/// </summary>
		public class UpdateTPreviousSubjectsParams
		{
			public int SubjectId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectCode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string NqfLevel { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string SubjectResult { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTPreviousSubjects(UpdateTPreviousSubjectsParams updateTPreviousSubjectsParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_previous_subjects";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = updateTPreviousSubjectsParams.SubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_NAME";
			parameter.Value = updateTPreviousSubjectsParams.SubjectName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_CODE";
			parameter.Value = updateTPreviousSubjectsParams.SubjectCode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NQF_LEVEL";
			parameter.Value = updateTPreviousSubjectsParams.NqfLevel;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_RESULT";
			parameter.Value = updateTPreviousSubjectsParams.SubjectResult;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_previous_subjects

		#region usp_update_t_resource

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_resource
		/// </summary>
		public class UpdateTResourceParams
		{
			public int ResourceId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ContentLink { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ResourceType { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Description { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Title { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Icon { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTResource(UpdateTResourceParams updateTResourceParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_resource";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@RESOURCE_ID";
			parameter.Value = updateTResourceParams.ResourceId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CONTENT_LINK";
			parameter.Value = updateTResourceParams.ContentLink;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@RESOURCE_TYPE";
			parameter.Value = updateTResourceParams.ResourceType;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DESCRIPTION";
			parameter.Value = updateTResourceParams.Description;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@TITLE";
			parameter.Value = updateTResourceParams.Title;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ICON";
			parameter.Value = updateTResourceParams.Icon;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_resource

		#region usp_update_t_subject

		public static DbCommand CreateCommandForUpdateTSubject(int subjectId, string subjectName, string subjectIkon)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = subjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_NAME";
			parameter.Value = subjectName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_IKON";
			parameter.Value = subjectIkon;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_subject

		#region usp_update_t_subject_course

		public static DbCommand CreateCommandForUpdateTSubjectCourse(int subjectCourseId, int subjectId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_subject_course";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_COURSE_ID";
			parameter.Value = subjectCourseId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_ID";
			parameter.Value = subjectId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_subject_course

		#region usp_update_t_user

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_user
		/// </summary>
		public class UpdateTUserParams
		{
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FirstName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string LastName { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Gender { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Email { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HomeLanguage { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Nationality { get; set; }
			public DateTime DateOfBirth { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HomeAddress { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string PostalAddress { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string City { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Country { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string PostalCode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MedicalAid { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MedicalNumber { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string EthnicGroup { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Disabilities { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string AccountId { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Password { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Question { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Passcode { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Status { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MarketingMedium { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string MarketingComment { get; set; }
			public DateTime MarketingDateOfSubmission { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string OccupationStatus { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string HighSchoolDetails { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string Avatar { get; set; }
			public int IsOnline { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string ProfileStatus { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string CellPhone { get; set; }
			public bool IsActive { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FamilyType { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string FamilyId { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTUser(UpdateTUserParams updateTUserParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_user";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = updateTUserParams.UserId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FIRST_NAME";
			parameter.Value = updateTUserParams.FirstName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@LAST_NAME";
			parameter.Value = updateTUserParams.LastName;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@GENDER";
			parameter.Value = updateTUserParams.Gender;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@EMAIL";
			parameter.Value = updateTUserParams.Email;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HOME_LANGUAGE";
			parameter.Value = updateTUserParams.HomeLanguage;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@NATIONALITY";
			parameter.Value = updateTUserParams.Nationality;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DATE_OF_BIRTH";
			parameter.Value = updateTUserParams.DateOfBirth;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HOME_ADDRESS";
			parameter.Value = updateTUserParams.HomeAddress;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@POSTAL_ADDRESS";
			parameter.Value = updateTUserParams.PostalAddress;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CITY";
			parameter.Value = updateTUserParams.City;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@COUNTRY";
			parameter.Value = updateTUserParams.Country;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@POSTAL_CODE";
			parameter.Value = updateTUserParams.PostalCode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MEDICAL_AID";
			parameter.Value = updateTUserParams.MedicalAid;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MEDICAL_NUMBER";
			parameter.Value = updateTUserParams.MedicalNumber;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ETHNIC_GROUP";
			parameter.Value = updateTUserParams.EthnicGroup;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DISABILITIES";
			parameter.Value = updateTUserParams.Disabilities;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@ACCOUNT_ID";
			parameter.Value = updateTUserParams.AccountId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PASSWORD";
			parameter.Value = updateTUserParams.Password;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@QUESTION";
			parameter.Value = updateTUserParams.Question;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PASSCODE";
			parameter.Value = updateTUserParams.Passcode;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@STATUS";
			parameter.Value = updateTUserParams.Status;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_MEDIUM";
			parameter.Value = updateTUserParams.MarketingMedium;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_COMMENT";
			parameter.Value = updateTUserParams.MarketingComment;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARKETING_DATE_OF_SUBMISSION";
			parameter.Value = updateTUserParams.MarketingDateOfSubmission;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@OCCUPATION_STATUS";
			parameter.Value = updateTUserParams.OccupationStatus;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@HIGH_SCHOOL_DETAILS";
			parameter.Value = updateTUserParams.HighSchoolDetails;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@AVATAR";
			parameter.Value = updateTUserParams.Avatar;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_ONLINE";
			parameter.Value = updateTUserParams.IsOnline;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@PROFILE_STATUS";
			parameter.Value = updateTUserParams.ProfileStatus;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CELL_PHONE";
			parameter.Value = updateTUserParams.CellPhone;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Boolean;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_ACTIVE";
			parameter.Value = updateTUserParams.IsActive;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FAMILY_TYPE";
			parameter.Value = updateTUserParams.FamilyType;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@FAMILY_ID";
			parameter.Value = updateTUserParams.FamilyId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_user

		#region usp_update_t_user_assignment

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_user_assignment
		/// </summary>
		public class UpdateTUserAssignmentParams
		{
			public int UserAssignmentId { get; set; }
			public int Mark { get; set; }
			public DateTime SubmitDate { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string DownloadFile { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UploadFile { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTUserAssignment(UpdateTUserAssignmentParams updateTUserAssignmentParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_user_assignment";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ASSIGNMENT_ID";
			parameter.Value = updateTUserAssignmentParams.UserAssignmentId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@MARK";
			parameter.Value = updateTUserAssignmentParams.Mark;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.DateTime;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBMIT_DATE";
			parameter.Value = updateTUserAssignmentParams.SubmitDate;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@DOWNLOAD_FILE";
			parameter.Value = updateTUserAssignmentParams.DownloadFile;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@UPLOAD_FILE";
			parameter.Value = updateTUserAssignmentParams.UploadFile;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = updateTUserAssignmentParams.UserId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_user_assignment

		#region usp_update_t_user_chat_group

		public static DbCommand CreateCommandForUpdateTUserChatGroup(int userChatGroupId, string userId, int chatGroupId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_user_chat_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_CHAT_GROUP_ID";
			parameter.Value = userChatGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@CHAT_GROUP_ID";
			parameter.Value = chatGroupId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_user_chat_group

		#region usp_update_t_user_group

		public static DbCommand CreateCommandForUpdateTUserGroup(int userGroupId, string userId)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_user_group";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_GROUP_ID";
			parameter.Value = userGroupId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = userId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_user_group

		#region usp_update_t_user_subject

		/// <summary>
		/// This class is used to pass parameters to the command associated
		/// with the StoredProcedure - usp_update_t_user_subject
		/// </summary>
		public class UpdateTUserSubjectParams
		{
			public int UserSubjectId { get; set; }
			public bool IsComplete { get; set; }
			public decimal SubjectMark { get; set; }
			/// <summary>
			/// Max Length = 50
			/// </summary>
			public string UserId { get; set; }
		}

		public static DbCommand CreateCommandForUpdateTUserSubject(UpdateTUserSubjectParams updateTUserSubjectParams)
		{
			var command = dbConnection.CreateCommand();
			command.CommandType = CommandType.StoredProcedure;
			command.CommandText = "usp_update_t_user_subject";
			var parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.ReturnValue;
			parameter.ParameterName = "@RETURN";
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Int32;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_SUBJECT_ID";
			parameter.Value = updateTUserSubjectParams.UserSubjectId;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Boolean;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@IS_COMPLETE";
			parameter.Value = updateTUserSubjectParams.IsComplete;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.Decimal;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@SUBJECT_MARK";
			parameter.Value = updateTUserSubjectParams.SubjectMark;
			command.Parameters.Add(parameter);
			parameter = dbProviderFactory.CreateParameter();
			parameter.DbType = DbType.String;
			parameter.Size = 50;
			parameter.Direction = ParameterDirection.Input;
			parameter.ParameterName = "@USER_ID";
			parameter.Value = updateTUserSubjectParams.UserId;
			command.Parameters.Add(parameter);
			return command;
		}

		#endregion usp_update_t_user_subject

	}
}
